<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/IndexMap.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">IndexMap.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_index_map_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_INDEXMAP_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_INDEXMAP_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_index_set_8h.html">helib/IndexSet.h</a>&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="cloned_ptr_8h.html">helib/clonedPtr.h</a>&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map_init.html">   26</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_index_map_init.html">IndexMapInit</a></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;{</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map_init.html#a7e1f57a217473eb6d90ce8c0e2955dff">   30</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map_init.html#a7e1f57a217473eb6d90ce8c0e2955dff">init</a>(T&amp;) = 0;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map_init.html#a043b99dbd3c1d9734f6d92b45b71f76b">   33</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_index_map_init.html">IndexMapInit&lt;T&gt;</a>* <a class="code" href="classhelib_1_1_index_map_init.html#a043b99dbd3c1d9734f6d92b45b71f76b">clone</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map_init.html#ab086149f64946c5dceda565395f03f55">   34</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_index_map_init.html#ab086149f64946c5dceda565395f03f55">~IndexMapInit</a>() {} <span class="comment">// ensure that derived destructor is called</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;};</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html">   42</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_index_map.html">IndexMap</a></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;{</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;  std::unordered_map&lt;long, T&gt; map;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a> indexSet;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  cloned_ptr&lt;IndexMapInit&lt;T&gt;&gt; init;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#ad334edd9b3eb65dd3af37f54452e677e">   52</a></span>&#160;  <a class="code" href="classhelib_1_1_index_map.html#ad334edd9b3eb65dd3af37f54452e677e">IndexMap</a>();</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#a3147a5321626654bc6822aaaac1656fe">   62</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_index_map.html#a3147a5321626654bc6822aaaac1656fe">IndexMap</a>(<a class="code" href="classhelib_1_1_index_map_init.html">IndexMapInit&lt;T&gt;</a>* _init) : init(_init) {}</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">   65</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; <a class="code" href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">getIndexSet</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> indexSet; }</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#a6c51045be5fad53cc7b9ec8d02b6d903">   69</a></span>&#160;  T&amp; <a class="code" href="classhelib_1_1_index_map.html#a6c51045be5fad53cc7b9ec8d02b6d903">operator[]</a>(<span class="keywordtype">long</span> j)</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  {</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <a class="code" href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">assertTrue</a>(indexSet.<a class="code" href="classhelib_1_1_index_set.html#acefa7b80f5a87642f706e726063ec462">contains</a>(j), <span class="stringliteral">&quot;Key not found&quot;</span>);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="keywordflow">return</span> map[j];</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  }</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#af5216c7d80f1c6e1821f98746ee0b47d">   74</a></span>&#160;  <span class="keyword">const</span> T&amp; <a class="code" href="classhelib_1_1_index_map.html#af5216c7d80f1c6e1821f98746ee0b47d">operator[]</a>(<span class="keywordtype">long</span> j)<span class="keyword"> const</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">assertTrue</a>(indexSet.<a class="code" href="classhelib_1_1_index_set.html#acefa7b80f5a87642f706e726063ec462">contains</a>(j), <span class="stringliteral">&quot;Key not found&quot;</span>);</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="comment">// unordered_map does not support a const [] operator,</span></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">// so we have to artificially strip away the const-ness here</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    std::unordered_map&lt;long, T&gt;&amp; map1 =</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keyword">const_cast&lt;</span>std::unordered_map&lt;long, T&gt;&amp;<span class="keyword">&gt;</span>(map);</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">return</span> map1[j];</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  }</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#ad644fbc8cfa3a3de5597194b4ca20224">   87</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map.html#ad644fbc8cfa3a3de5597194b4ca20224">insert</a>(<span class="keywordtype">long</span> j)</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;  {</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">if</span> (!indexSet.<a class="code" href="classhelib_1_1_index_set.html#acefa7b80f5a87642f706e726063ec462">contains</a>(j)) {</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;      indexSet.<a class="code" href="classhelib_1_1_index_set.html#aa2957053dea143c8ca64766f514306c3">insert</a>(j);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;      <span class="keywordflow">if</span> (!init.null())</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        init-&gt;init(map[j]);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  }</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#a07228d7cbcab8013b6d5101caa9cad64">   95</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map.html#a07228d7cbcab8013b6d5101caa9cad64">insert</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s)</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  {</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = s.<a class="code" href="classhelib_1_1_index_set.html#a30a96e32a1bec249fb56f83bbb6f4afa">first</a>(); i &lt;= s.<a class="code" href="classhelib_1_1_index_set.html#a8156f49ca3715bf0cf9c63ac8dc02172">last</a>(); i = s.<a class="code" href="classhelib_1_1_index_set.html#a5690665e0de625096ca1091ea3c39f74">next</a>(i))</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;      <a class="code" href="classhelib_1_1_index_map.html#ad644fbc8cfa3a3de5597194b4ca20224">insert</a>(i);</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  }</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#a71e808a119fbe9f2af2ea4d7547f9207">  102</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map.html#a71e808a119fbe9f2af2ea4d7547f9207">remove</a>(<span class="keywordtype">long</span> j)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    indexSet.<a class="code" href="classhelib_1_1_index_set.html#a7444b5370e0abbbff89c27215912e14d">remove</a>(j);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    map.erase(j);</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  }</div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#ac4c4b6ab715528e13fe86b5723566b70">  107</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map.html#ac4c4b6ab715528e13fe86b5723566b70">remove</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s)</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  {</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = s.<a class="code" href="classhelib_1_1_index_set.html#a30a96e32a1bec249fb56f83bbb6f4afa">first</a>(); i &lt;= s.<a class="code" href="classhelib_1_1_index_set.html#a8156f49ca3715bf0cf9c63ac8dc02172">last</a>(); i = s.<a class="code" href="classhelib_1_1_index_set.html#a5690665e0de625096ca1091ea3c39f74">next</a>(i))</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;      map.erase(i);</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    indexSet.<a class="code" href="classhelib_1_1_index_set.html#a7444b5370e0abbbff89c27215912e14d">remove</a>(s);</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classhelib_1_1_index_map.html#aeac37e914ee7cda0f94d26d68efda381">  114</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_index_map.html#aeac37e914ee7cda0f94d26d68efda381">clear</a>()</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  {</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    map.clear();</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    indexSet.<a class="code" href="classhelib_1_1_index_set.html#a8b52e2294f9cf2596d4245a24105555b">clear</a>();</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;};</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad5f68b7e6b0ff2bbf68b999655480fac">  123</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#ad5f68b7e6b0ff2bbf68b999655480fac">operator==</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_map.html">IndexMap&lt;T&gt;</a>&amp; map1, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_map.html">IndexMap&lt;T&gt;</a>&amp; map2)</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;{</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <span class="keywordflow">if</span> (map1.<a class="code" href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">getIndexSet</a>() != map2.<a class="code" href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">getIndexSet</a>())</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_set.html">IndexSet</a>&amp; s = map1.<a class="code" href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">getIndexSet</a>();</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = s.<a class="code" href="classhelib_1_1_index_set.html#a30a96e32a1bec249fb56f83bbb6f4afa">first</a>(); i &lt;= s.<a class="code" href="classhelib_1_1_index_set.html#a8156f49ca3715bf0cf9c63ac8dc02172">last</a>(); i = s.<a class="code" href="classhelib_1_1_index_set.html#a5690665e0de625096ca1091ea3c39f74">next</a>(i)) {</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keywordflow">if</span> (map1[i] == map2[i])</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  }</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;}</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160; </div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="namespacehelib.html#adcd34bfd104a104754a69b08d12882a4">  137</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#adcd34bfd104a104754a69b08d12882a4">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_map.html">IndexMap&lt;T&gt;</a>&amp; map1, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_index_map.html">IndexMap&lt;T&gt;</a>&amp; map2)</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;{</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  <span class="keywordflow">return</span> !(map1 == map2);</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;}</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160; </div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_INDEXMAP_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespacehelib_html_ad5f68b7e6b0ff2bbf68b999655480fac"><div class="ttname"><a href="namespacehelib.html#ad5f68b7e6b0ff2bbf68b999655480fac">helib::operator==</a></div><div class="ttdeci">bool operator==(const IndexMap&lt; T &gt; &amp;map1, const IndexMap&lt; T &gt; &amp;map2)</div><div class="ttdoc">Comparing maps, by comparing all the elements.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:123</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_init_html_a043b99dbd3c1d9734f6d92b45b71f76b"><div class="ttname"><a href="classhelib_1_1_index_map_init.html#a043b99dbd3c1d9734f6d92b45b71f76b">helib::IndexMapInit::clone</a></div><div class="ttdeci">virtual IndexMapInit&lt; T &gt; * clone() const =0</div><div class="ttdoc">Cloning a pointer, override with code to create a fresh copy.</div></div>
<div class="ttc" id="anamespacehelib_html_aca37b5e05bffd4550c995e83594d7325"><div class="ttname"><a href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">helib::assertTrue</a></div><div class="ttdeci">void assertTrue(const T &amp;value, const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> assertions.h:61</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_acefa7b80f5a87642f706e726063ec462"><div class="ttname"><a href="classhelib_1_1_index_set.html#acefa7b80f5a87642f706e726063ec462">helib::IndexSet::contains</a></div><div class="ttdeci">bool contains(long j) const</div><div class="ttdoc">Returns true iff the set contains j.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:76</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a8156f49ca3715bf0cf9c63ac8dc02172"><div class="ttname"><a href="classhelib_1_1_index_set.html#a8156f49ca3715bf0cf9c63ac8dc02172">helib::IndexSet::last</a></div><div class="ttdeci">long last() const</div><div class="ttdoc">Returns the last element, -1 if the set is empty.</div><div class="ttdef"><b>Definition:</b> IndexSet.h:71</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_af5216c7d80f1c6e1821f98746ee0b47d"><div class="ttname"><a href="classhelib_1_1_index_map.html#af5216c7d80f1c6e1821f98746ee0b47d">helib::IndexMap::operator[]</a></div><div class="ttdeci">const T &amp; operator[](long j) const</div><div class="ttdef"><b>Definition:</b> IndexMap.h:74</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_ab90e2fb448b41be128b5d41a5dbd27e9"><div class="ttname"><a href="classhelib_1_1_index_map.html#ab90e2fb448b41be128b5d41a5dbd27e9">helib::IndexMap::getIndexSet</a></div><div class="ttdeci">const IndexSet &amp; getIndexSet() const</div><div class="ttdoc">Get the underlying index set.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:65</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_init_html_ab086149f64946c5dceda565395f03f55"><div class="ttname"><a href="classhelib_1_1_index_map_init.html#ab086149f64946c5dceda565395f03f55">helib::IndexMapInit::~IndexMapInit</a></div><div class="ttdeci">virtual ~IndexMapInit()</div><div class="ttdef"><b>Definition:</b> IndexMap.h:34</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html"><div class="ttname"><a href="classhelib_1_1_index_map.html">helib::IndexMap</a></div><div class="ttdoc">IndexMap&lt;T&gt; implements a generic map indexed by a dynamic index set.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:43</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html"><div class="ttname"><a href="classhelib_1_1_index_set.html">helib::IndexSet</a></div><div class="ttdoc">A dynamic set of non-negative integers.</div><div class="ttdef"><b>Definition:</b> IndexSet.h:31</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_ad644fbc8cfa3a3de5597194b4ca20224"><div class="ttname"><a href="classhelib_1_1_index_map.html#ad644fbc8cfa3a3de5597194b4ca20224">helib::IndexMap::insert</a></div><div class="ttdeci">void insert(long j)</div><div class="ttdoc">Insert indexes to the IndexSet. Insertion will cause new T objects to be created, using the default c...</div><div class="ttdef"><b>Definition:</b> IndexMap.h:87</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_aa2957053dea143c8ca64766f514306c3"><div class="ttname"><a href="classhelib_1_1_index_set.html#aa2957053dea143c8ca64766f514306c3">helib::IndexSet::insert</a></div><div class="ttdeci">void insert(long j)</div><div class="ttdoc">Add j to the set.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:128</div></div>
<div class="ttc" id="anamespacehelib_html_adcd34bfd104a104754a69b08d12882a4"><div class="ttname"><a href="namespacehelib.html#adcd34bfd104a104754a69b08d12882a4">helib::operator!=</a></div><div class="ttdeci">bool operator!=(const IndexMap&lt; T &gt; &amp;map1, const IndexMap&lt; T &gt; &amp;map2)</div><div class="ttdef"><b>Definition:</b> IndexMap.h:137</div></div>
<div class="ttc" id="a_index_set_8h_html"><div class="ttname"><a href="_index_set_8h.html">IndexSet.h</a></div><div class="ttdoc">A dynamic set of integers.</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a5690665e0de625096ca1091ea3c39f74"><div class="ttname"><a href="classhelib_1_1_index_set.html#a5690665e0de625096ca1091ea3c39f74">helib::IndexSet::next</a></div><div class="ttdeci">long next(long j) const</div><div class="ttdoc">Returns the next element after j, if any; otherwise j+1.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:48</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_ac4c4b6ab715528e13fe86b5723566b70"><div class="ttname"><a href="classhelib_1_1_index_map.html#ac4c4b6ab715528e13fe86b5723566b70">helib::IndexMap::remove</a></div><div class="ttdeci">void remove(const IndexSet &amp;s)</div><div class="ttdef"><b>Definition:</b> IndexMap.h:107</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_a07228d7cbcab8013b6d5101caa9cad64"><div class="ttname"><a href="classhelib_1_1_index_map.html#a07228d7cbcab8013b6d5101caa9cad64">helib::IndexMap::insert</a></div><div class="ttdeci">void insert(const IndexSet &amp;s)</div><div class="ttdef"><b>Definition:</b> IndexMap.h:95</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a8b52e2294f9cf2596d4245a24105555b"><div class="ttname"><a href="classhelib_1_1_index_set.html#a8b52e2294f9cf2596d4245a24105555b">helib::IndexSet::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdoc">Set to the empty set.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:120</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a30a96e32a1bec249fb56f83bbb6f4afa"><div class="ttname"><a href="classhelib_1_1_index_set.html#a30a96e32a1bec249fb56f83bbb6f4afa">helib::IndexSet::first</a></div><div class="ttdeci">long first() const</div><div class="ttdoc">Returns the first element, 0 if the set is empty.</div><div class="ttdef"><b>Definition:</b> IndexSet.h:68</div></div>
<div class="ttc" id="aclasshelib_1_1_index_set_html_a7444b5370e0abbbff89c27215912e14d"><div class="ttname"><a href="classhelib_1_1_index_set.html#a7444b5370e0abbbff89c27215912e14d">helib::IndexSet::remove</a></div><div class="ttdeci">void remove(long j)</div><div class="ttdoc">Remove j from the set.</div><div class="ttdef"><b>Definition:</b> IndexSet.cpp:154</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_init_html_a7e1f57a217473eb6d90ce8c0e2955dff"><div class="ttname"><a href="classhelib_1_1_index_map_init.html#a7e1f57a217473eb6d90ce8c0e2955dff">helib::IndexMapInit::init</a></div><div class="ttdeci">virtual void init(T &amp;)=0</div><div class="ttdoc">Initialization function, override with initialization code.</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_a71e808a119fbe9f2af2ea4d7547f9207"><div class="ttname"><a href="classhelib_1_1_index_map.html#a71e808a119fbe9f2af2ea4d7547f9207">helib::IndexMap::remove</a></div><div class="ttdeci">void remove(long j)</div><div class="ttdoc">Delete indexes from IndexSet, may cause objects to be destroyed.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:102</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_a6c51045be5fad53cc7b9ec8d02b6d903"><div class="ttname"><a href="classhelib_1_1_index_map.html#a6c51045be5fad53cc7b9ec8d02b6d903">helib::IndexMap::operator[]</a></div><div class="ttdeci">T &amp; operator[](long j)</div><div class="ttdoc">Access functions: will raise an error if j does not belong to the current index set.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:69</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_init_html"><div class="ttname"><a href="classhelib_1_1_index_map_init.html">helib::IndexMapInit</a></div><div class="ttdoc">Initializing elements in an IndexMap.</div><div class="ttdef"><b>Definition:</b> IndexMap.h:27</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_aeac37e914ee7cda0f94d26d68efda381"><div class="ttname"><a href="classhelib_1_1_index_map.html#aeac37e914ee7cda0f94d26d68efda381">helib::IndexMap::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> IndexMap.h:114</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_a3147a5321626654bc6822aaaac1656fe"><div class="ttname"><a href="classhelib_1_1_index_map.html#a3147a5321626654bc6822aaaac1656fe">helib::IndexMap::IndexMap</a></div><div class="ttdeci">IndexMap(IndexMapInit&lt; T &gt; *_init)</div><div class="ttdoc">A map with an initialization object. This associates a method for initializing new elements in the ma...</div><div class="ttdef"><b>Definition:</b> IndexMap.h:62</div></div>
<div class="ttc" id="acloned_ptr_8h_html"><div class="ttname"><a href="cloned_ptr_8h.html">clonedPtr.h</a></div><div class="ttdoc">Implementation of smart pointers with &quot;deep cloning&quot; semantics.</div></div>
<div class="ttc" id="aclasshelib_1_1_index_map_html_ad334edd9b3eb65dd3af37f54452e677e"><div class="ttname"><a href="classhelib_1_1_index_map.html#ad334edd9b3eb65dd3af37f54452e677e">helib::IndexMap::IndexMap</a></div><div class="ttdeci">IndexMap()</div><div class="ttdoc">The empty map.</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
